package com.frxuexi.park2302.my.adapter

import androidx.databinding.DataBindingUtil
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.frxuexi.lib_base.entity.MyApplyEntity
import com.frxuexi.park2302.R
import com.frxuexi.park2302.databinding.ItemMyaskBinding

class MyApplyAdapter:BaseQuickAdapter<MyApplyEntity,BaseViewHolder>(R.layout.item_myask) {
    override fun onItemViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) {
        super.onItemViewHolderCreated(viewHolder, viewType)
        DataBindingUtil.bind<ItemMyaskBinding>(viewHolder.itemView)
    }
    override fun convert(helper: BaseViewHolder, item: MyApplyEntity) {
        val binding = DataBindingUtil.getBinding<ItemMyaskBinding>(helper.itemView)!!
        binding.bean=item
        binding.historyStatus.apply {
            when(item.status){
                "空闲","已通过","已完成"->setTextColor(context.getColor(R.color.green))
                "已占用","待审核","待处理","未巡检"->setTextColor(context.getColor(R.color.blue))
                "维护中","驳回","处理中","巡检中"->setTextColor(context.getColor(R.color.orange))
            }
        }

    }
}